<?php

function getItemHtml($image_height,$image_url,$image_link)
{
    $image_height = $image_height.'px';
    return "
<li class='item'>
    <a style='height:$image_height;background-image: url($image_url);' target='_blank'  $image_link  class='image' ></a>
</li>
    ";
}

$blue_arrows = '';
if(getParam('is_show_arrows','show') == 'show') {
    $blue_arrows = 'blue_arrow';
}



?>

<div class='module dshop-um-wl-lb-96 module-thirdparty'
     style='margin-bottom:<? echo $bottom_margin; ?>px; background-color:<? echo $bottom_color; ?>;'>

    <div class='container m-sop-slide <?php myEcho('is_show_ring','')?>' >
        <div class='inner_container'>
            <ol class='slide-pics'>
                <?php

                    $image_height_array = array();
                    $arrayMap = array();
                    $is_empty = true;

                    for($i = 0; $i < getParam('image_num',2);$i++){
                        $image_url = getParam('image_url_'.$i,'');
                        if(empty($image_url)){
                            continue;
                        }

                        $is_empty = false;
                        $image_height = getParam('image_height_'.$i,400);
                        array_push($image_height_array,$image_height);
                        echo getItemHtml(
                                $image_height,
                                $image_url,
                                getHref('image_link_'.$i));
                    }

                    $button_top = $is_empty ? '200px': (max($image_height_array) / 2).'px';
                    if($is_empty){
                        echo getItemHtml(
                            '400',
                            'assets/images/960.jpg',
                            'href="#"');
                        echo getItemHtml(
                            '400',
                            'assets/images/9602.jpg',
                            'href="#"');
                    }

                ?>
            </ol>
        </div>

        <?php
            if(getParam('is_show_arrows','show') == 'show'){
                $arrow_type = getParam('arrows_type','');
                $blue_arrows_next = $arrow_type.'_next';
                $blue_arrows_prev = $arrow_type.'_prev';

                echo "
                    <a style='top:$button_top;' class='prev-btn $blue_arrows_prev'></a>
                    <a style='top:$button_top;' class='next-btn $blue_arrows_next'></a>
                ";
            }
        ?>


    </div>

</div>
